<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组拷贝</title>
</head>
<body>
    <script>
        let arr = ["小明", "小王"];

        let brr = []; // 新数组
        for (let i = 0; i < arr.length; i++) {
            brr.push(arr[i]);
        }
        arr.push("黑马");
        console.log(brr); // ["小明", "小王"]

        // 总结: 
        // 拷贝: 准备一个新的对象/数组, 把旧的内值复制过来
        // 浅拷贝: 只拷贝第一层的值
    </script>
</body>
</html>